/* const express = require('express')

const app = express()

app.use((req,res,next)=>{
    console.log('简化版全局中间件1')
    next()
})

app.use((req,res,next)=>{
    console.log('简化版全局中间件2')
    next()
})

app.get('/',(req,res)=>{
    res.send({
        msg:'express 中间件学习'
    })
})

app.listen(8080,()=>{
    console.log('8080 running')
}) */

/* const express = require('express')

const app = express()

app.use((req,res,next)=>{
    console.log('简化版全局中间件1')
    next()
})

app.use((req,res,next)=>{
    console.log('简化版全局中间件2')
    next()
})

app.get('/',(req,res)=>{
    res.send({
        msg:'express 中间件学习'
    })
})

app.listen(8080,()=>{
    console.log('8080 running')
}) */

const express = require('express')

const app = express()

app.use((req,res,next)=>{
    console.log('midware1')
    next()
})

app.use((req,res,next)=>{
    console.log('midware2')
    next()
})

app.get('/',(req,res)=>{
    res.send({
        msg:'midware learning'
    })
})

app.listen(8080,()=>{
    console.log('8080 running')
})